#include <iostream>

#include <cstring>
using namespace std;


class Person
{
public:
    Person()
    {
        cout<<"父类无参构造"<<endl;
    }

    virtual ~Person()
    {
        cout<<"父类析构函数 "<<endl;
    }

    virtual int makeMoney()
    {
        cout<<"Person 赚钱 "<<endl;
        return 0;
    }

private:
    long m_age;
};

class Student : public Person
{
public:
    Student(const char * name)
    {
        cout<<"子类无参构造"<<endl;
        m_name = new char[32];
        strncpy(m_name, name, sizeof(name) + 1);
    }
    ~Student()
    {
        cout<<"子类析构函数 "<<endl;
        delete []m_name;
    }
    /* 重写*/
    int makeMoney()
    {
        Person::makeMoney();
        cout<<"Person 兼职-赚钱 "<<endl;
        return 0;
    }
    

public:
    long m_no;
    char *m_name;

};

// class Teachr : public Person
// {
// public:
//     Teachr()
//     {
//         cout<<"子类无参构造"<<endl;
//     }
//     ~Teachr()
//     {
//         cout<<"子类析构函数 "<<endl;
//     }
//     /* 重写*/
//     int makeMoney()
//     {
//         cout<<"Person 出书-赚钱 "<<endl;
//         return 0;
//     }

// public:
//     int m_hari;

// };


int main()
{
    Person * per = new Student("zahngsan");

    delete per;

    return 0;
}